package com.guch.help.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import com.guch.help.R;
import com.guch.help.databinding.ActivityIntroductionBinding;
import com.guch.help.utils.ProtectedSpUtils;

/**
 * 引导页
 */
public class IntroductionPageActivity extends AppCompatActivity {

    private ActivityIntroductionBinding mBinding;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mBinding = DataBindingUtil.setContentView(this, R.layout.activity_introduction);
        mBinding.btnNext.setOnClickListener(v -> {
            mBinding.rlIntroduction1.setVisibility(View.GONE);
            mBinding.btnNext.setVisibility(View.GONE);
            mBinding.rlIntroduction2.setVisibility(View.VISIBLE);
            mBinding.btnComplete.setVisibility(View.VISIBLE);
        });
        mBinding.btnComplete.setOnClickListener(v -> {
            ProtectedSpUtils.getInstance(ProtectedSpUtils.DEEP_DEL_SP_NAME).putBoolean(ProtectedSpUtils.DEEP_DEL_FIRST_ENTER_KEY, true);
            // 记录已显示完毕
            gotoMainActivity();
        });
    }

    private void gotoMainActivity() {
        startActivity(new Intent(this, NavigationActivity.class));
        finish();
    }

}
